package com.os.effective;

//Singleton with public final field
public class Elvis {

    public static final Elvis INSTANCE = new Elvis();

    private Elvis(){

    }

    public static Elvis getInstance(){
        return INSTANCE;
    }

    public void leaveThBuilding(){

    }

    //readResolve method to preserve singleton property
    private Object readResolve(){
        //return the one true Elvis and let the garbage collector
        //take care of the Elvis impersonator
        return INSTANCE;
    }
}
